/*
 * ChatServer.h
 *
 *  Created on: Dec 4, 2013
 *      Author: gonprieto
 */

#ifndef ChatServer_H_
#define ChatServer_H_

#include "Process.h"
#include "string"
#include "../communication/SocketProtocoloPlano.h"
#include <map>
#include "../communication/FifoProtocoloPlano.h"
#include "Chat_Admin.h"

class ChatServer : public Process{

protected:
	typedef struct Configuracion{
		std::string destino;
		unsigned int puerto;

		Configuracion() :
			destino("localhost"),
			puerto(6666){}
		;;
	};

public:
	ChatServer();
	virtual ~ChatServer();

	void showHelp();

	virtual int runProcess(int argc, char **argv);

protected:
	Configuracion parseParams(int argc, char **argv);

	void terminarHandshake(SocketProtocoloPlano* spp);

	void lecturaDeMensajes();

	int atenderCliente(SocketProtocoloPlano* sppNuevoCliente);

private:
	QueueProtocoloPlano queue;

	Chat_Admin chatAdmin;
};

#endif /* ChatServer_H_ */
